package com.movitech.mobile.cz.base.purchase.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.movitech.mobile.cz.base.purchase.entity.WFlowFormIbTechScore;
import com.movitech.mobile.cz.base.purchase.entity.ext.ExtWFlowFormIbTechScore;
import com.movitech.mobile.cz.base.purchase.mapper.WFlowFormIbTechScoreMapper;
import com.movitech.mobile.cz.base.purchase.mapper.ext.ExtWFlowFormIbTechScoreMapper;
import com.movitech.mobile.cz.base.purchase.service.WFlowFormIbTechScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 流程表单-询标-技术标评分 服务实现类
 * </p>
 *
 * @author Movitech Mobile
 * @since 2018-03-15
 */
@Service
public class WFlowFormIbTechScoreServiceImpl extends ServiceImpl<WFlowFormIbTechScoreMapper, WFlowFormIbTechScore> implements WFlowFormIbTechScoreService {

    @Autowired
    private ExtWFlowFormIbTechScoreMapper extWFlowFormIbTechScoreMapper;

    @Override
    public List<ExtWFlowFormIbTechScore> getExtByFormId(String formId) {
        return extWFlowFormIbTechScoreMapper.getByFormId(formId);
    }

    @Override
    public Integer isSocreEnd(String formId) {
        WFlowFormIbTechScore wFlowFormIbTechScore = new WFlowFormIbTechScore();
        wFlowFormIbTechScore.setFlowFormId(formId);
        EntityWrapper entityWrapper = new EntityWrapper();
        entityWrapper.setEntity(wFlowFormIbTechScore);
        entityWrapper.isNull("technical_score");
        Integer count = selectCount(entityWrapper);
        return count==0?1:0;
    }
}
